/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sv.com.dizucar.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author 43579648
 */
@Entity
@Table(name = "CAJERO", catalog = "", schema = "DIZUCAR")
@NamedQueries({
    @NamedQuery(name = "Cajero.findAll", query = "SELECT c FROM Cajero c"),
    @NamedQuery(name = "Cajero.findByIdcajero", query = "SELECT c FROM Cajero c WHERE c.idcajero = :idcajero"),
    @NamedQuery(name = "Cajero.findByApellido", query = "SELECT c FROM Cajero c WHERE c.apellido = :apellido"),
    @NamedQuery(name = "Cajero.findByNombre", query = "SELECT c FROM Cajero c WHERE c.nombre = :nombre")})
public class Cajero implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IDCAJERO", nullable = false)
    private Integer idcajero;
    @Basic(optional = false)
    @Column(name = "APELLIDO", nullable = false, length = 80)
    private String apellido;
    @Basic(optional = false)
    @Column(name = "NOMBRE", nullable = false, length = 80)
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cajero", fetch = FetchType.LAZY)
    private List<Venta> ventaList;
    @JoinColumn(name = "IDTIENEDA", referencedColumnName = "IDTIENEDA", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Tienda tienda;

    public Cajero() {
    }

    public Cajero(Integer idcajero) {
        this.idcajero = idcajero;
    }

    public Cajero(Integer idcajero, String apellido, String nombre) {
        this.idcajero = idcajero;
        this.apellido = apellido;
        this.nombre = nombre;
    }

    public Integer getIdcajero() {
        return idcajero;
    }

    public void setIdcajero(Integer idcajero) {
        this.idcajero = idcajero;
    }

    public String getApellido() {
        return apellido;
    }

    public void setApellido(String apellido) {
        this.apellido = apellido;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public List<Venta> getVentaList() {
        return ventaList;
    }

    public void setVentaList(List<Venta> ventaList) {
        this.ventaList = ventaList;
    }

    public Tienda getTienda() {
        return tienda;
    }

    public void setTienda(Tienda tienda) {
        this.tienda = tienda;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcajero != null ? idcajero.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cajero)) {
            return false;
        }
        Cajero other = (Cajero) object;
        if ((this.idcajero == null && other.idcajero != null) || (this.idcajero != null && !this.idcajero.equals(other.idcajero))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.com.dizucar.modelo.Cajero[idcajero=" + idcajero + "]";
    }

}
